-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issues with reading/writing JSON floats #56
Conversation
One thing that is bad, that in compare with google/double-conversation there are no included unit tests that you can run on every platform and every compiler, it should be fine for Mac OS/iOS, |
37bea44
to
03b3653
Compare
True. But I still chose to use this library over the larger Google one.
Not really. There's a nontrivial Swift community on Linux; IBM is a big backer of server-side Swift. And Swift itself is well-tested. |
10e5574
to
54661d8
Compare
* Reading/writing floating point was accidentally locale-dependent, which caused errors in locales that don't use '.' as the decimal point. (Fixes #54) * Improved round-trip accuracy of Fleece->JSON->Fleece float/double conversions, by writing the optimal number of decimal places. To do this we brought in a small subcomponent of Swift. (Fixes #55)
54661d8
to
2d4ff43
Compare
It's alllllmost building on Windows. MSVC is just complaining about the literal |
... yup, it's a hexadecimal floating-point literal, and the The good news is that this syntax was added to C++17 so we can work around the problem by bumping the compiler dialect to C++17 ... see, @borrrden, I found a good reason to switch! 🤣 |
Oh wonderful — Clang 5 claims to support C++17 ( |
Apparently MSVC doesn't support hex float literals at all. There's no mention of them in their docs. |
According to someone on SO, "Visual C++ will have [hex float literals] available in Visual Studio 2017 15.6 release." |
MSVC doesn't support them, at least not the version we build with
2c36172
to
a389a2d
Compare
I backed out the C++17 stuff and just changed the hex FP literals to regular ones. |
Yes, here is the official blog that says the feature is available in 15.5 (aka VS 2017). We can change AppVeyor to use that, but we also need to change our entire build infrastructure to move from VS2015 to VS2017 (something that eventually we will need to do) |
which caused errors in locales that don't use '.' as the decimal
point. (Fixes Errors parsing & writing JSON floats, in some locales #54)
conversions, by writing the optimal number of decimal places.
To do this we brought in a small subcomponent of Swift. (Fixes Roundoff error in round-trip of floats from Fleece->JSON->Fleece #55)
This PR does the same as #51, basically, but brings in a lot less 3rd party code.